#pragma once
#include<iostream>
#include<sys/socket.h>
#include<fcntl.h>
enum ExitCode
{
    OK=0,
    USAGE_ERR,
    SOCKET_ERR,
    BIND_ERR,
    LISTEN_ERR,
    CONNECT_ERR,
    FORK_ERR,
    OPEN_ERR,
    EPOLL_CREATE_ERR,
    ACCEPT_CONTINUE
};

class NoCopy
{
    public:
    NoCopy(){}
    ~NoCopy(){}
    NoCopy(const NoCopy& other)=delete;
    const NoCopy& operator=(const NoCopy& other)=delete;
};

void SetNonBlock(int fd)
{
    int f1=fcntl(fd,F_GETFL);
    if(f1<0)
    {
        return;
    }
    fcntl(fd,F_SETFL,f1|O_NONBLOCK);
}

#define CONV(addr) ((struct sockaddr* )&addr)